package com.cluster.user.controller;

import java.util.HashMap;

public class AjaxResult extends HashMap<String, Object> {

    public static AjaxResult success() {
        AjaxResult result = new AjaxResult();
        result.put("code", 200);
        result.put("message", "操作成功");
        return result;
    }

    public static AjaxResult success(String message) {
        AjaxResult result = success();
        result.put("message", message);
        return result;
    }

    public static AjaxResult error(String message) {
        AjaxResult result = new AjaxResult();
        result.put("code", 500);
        result.put("message", message);
        return result;
    }

    public AjaxResult put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}
